﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;

namespace CJJCH.Web
{
    public partial class Index : System.Web.UI.Page
    {
        CJJCH.BLL.T_INF_News bll_BookNews = new BLL.T_INF_News();
        CJJCH.BLL.T_NET_Standards bll_Standards = new BLL.T_NET_Standards();
        CJJCH.BLL.T_NET_News bll_news = new BLL.T_NET_News();
        CJJCH.BLL.T_NET_PicNews bll_picnews = new BLL.T_NET_PicNews();
        CJJCH.BLL.T_NET_Download bll_download = new BLL.T_NET_Download();
        public string strPic, strLink, strText;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ReapterDataBinding();
            }
        }
        private void ReapterDataBinding()
        {
            IList<CJJCH.Model.T_INF_News> news = new List<CJJCH.Model.T_INF_News>();
            news = bll_BookNews.GetNewsAgo();
            rptNews.DataSource = news;
            rptNews.DataBind();


            #region 绑定图片新闻

            DataSet ds = null;
            string PicUploadPath = LTP.Common.ConfigHelper.GetConfigString("UploadPic").Replace("~/", "");
            ds = bll_picnews.GetPicNews();
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (!dr["PicUrl"].ToString().Contains("://"))
                    {
                        strPic += dr["PicUrl"].ToString().Replace("~/", "") + "|";
                    }
                    else
                    {
                        strPic += dr["PicUrl"].ToString() + "|";
                    }
                    strLink += dr["HrefUrl"].ToString() + "|";
                    if (dr["Instructions"].ToString().Length > 10)
                    {
                        strText += dr["Instructions"].ToString().Substring(0, 10) + "…|";
                    }
                    else
                    {
                        strText += dr["Instructions"].ToString() + "|";
                    }
                }
            }

            strPic = string.IsNullOrEmpty(strPic) ? "" : strPic.Remove(strPic.Length - 1, 1).ToString();
            strLink = string.IsNullOrEmpty(strLink) ? "" : strLink.Remove(strLink.Length - 1, 1).ToString();
            strText = string.IsNullOrEmpty(strText) ? "" : strText.Remove(strText.Length - 1, 1).ToString();
            #endregion


            DataSet dss = new DataSet();
            dss = bll_news.GetListAgo();


            //技术标准  政策法规
            rptStandards1.DataSource = dss.Tables[0];
            rptStandards1.DataBind();

            //标准信息
            rptStandards2.DataSource = dss.Tables[1];
            rptStandards2.DataBind();

            //现行标准
            rptStandards3.DataSource = dss.Tables[2];
            rptStandards3.DataBind();

            //科技推广 评估资讯
            rptScience2.DataSource = dss.Tables[3];
            rptScience2.DataBind();

            //通知公告绑定
            this.lblTitle.Text = "通知通告";
            this.rptNotice.DataSource = dss.Tables[4].DefaultView;
            this.rptNotice.DataBind();

            //协会要问绑定
            this.lblTitle1.Text = "协会要闻";
            this.rptAssNews.DataSource = dss.Tables[5].DefaultView;
            this.rptAssNews.DataBind();

            //政策法规绑定
            this.lblTitle3.Text = "政策法规";
            this.rptPolReg.DataSource = dss.Tables[6].DefaultView;
            this.rptPolReg.DataBind();

            //行业要闻绑定
            this.lblTitle4.Text = "行业要闻";
            this.rptIndustryNews.DataSource = dss.Tables[7].DefaultView;
            this.rptIndustryNews.DataBind();

            //公益讲座
            rptTeach.DataSource = dss.Tables[8];
            rptTeach.DataBind();

            //专项培训
            rptTeach2.DataSource = dss.Tables[9];
            rptTeach2.DataBind();

            //科技推广 政策法规
            rptScience1.DataSource = dss.Tables[10];
            rptScience1.DataBind();
            
            //科技推广 检测认证 
            rptScience3.DataSource = dss.Tables[11];
            rptScience3.DataBind();

            //科技推广 成功推广
            rptScience4.DataSource = dss.Tables[12];
            rptScience4.DataBind();

            //下载类 常用资料
            rptDownload1.DataSource = dss.Tables[13];
            rptDownload1.DataBind();

            //下载类  讲座讲义
            rptDownload2.DataSource = dss.Tables[14];
            rptDownload2.DataBind();

            //下载来  电子刊物
            rptDownload3.DataSource = dss.Tables[15];
            rptDownload3.DataBind();

            //政府部门友情链接绑定
            this.dropGovDep.DataSource = dss.Tables[17].DefaultView;
            this.dropGovDep.DataValueField = "URLString";
            this.dropGovDep.DataTextField = "URLName";
            this.dropGovDep.DataBind();
            this.dropGovDep.Items.Insert(0, new ListItem("政府部门", ""));

            //北京市政府友情链接绑定
            this.dropbjGov.DataSource = dss.Tables[18].DefaultView;
            this.dropbjGov.DataValueField = "URLString";
            this.dropbjGov.DataTextField = "URLName";
            this.dropbjGov.DataBind();
            this.dropbjGov.Items.Insert(0, new ListItem("北京市政府", ""));

            //其他部门友情链接绑定
            this.dropOtherDep.DataSource = dss.Tables[20].DefaultView;
            this.dropOtherDep.DataValueField = "URLString";
            this.dropOtherDep.DataTextField = "URLName";
            this.dropOtherDep.DataBind();
            this.dropOtherDep.Items.Insert(0, new ListItem("其他部门", ""));

            //前两个友情链接绑定
            this.rptUr1l.DataSource = dss.Tables[21].DefaultView;
            this.rptUr1l.DataBind();

            //后两个友情链接绑定
            this.rptUr2l.DataSource = dss.Tables[22].DefaultView;
            this.rptUr2l.DataBind();

            //在线阅读
            if (dss.Tables[23].Rows.Count > 0)
            {
                for (int i = 0; i < dss.Tables[23].Rows.Count; i++)
                {
                    dss.Tables[23].Rows[i]["DataSource"] = "NewsDetail.aspx?ID=" + dss.Tables[23].Rows[i]["ID"].ToString() + "&firstid=6&secondid=21&thirdid=0";
                }
            }
            this.dropPublication.DataSource = dss.Tables[23].DefaultView;
            this.dropPublication.DataValueField = "DataSource";
            this.dropPublication.DataTextField = "DataTitle";
            this.dropPublication.DataBind();
            this.dropPublication.Items.Insert(0, new ListItem("请选择刊会刊物", ""));

            this.rptUr3l.DataSource = dss.Tables[24].DefaultView;
            this.rptUr3l.DataBind();

        }
        /// <summary>
        /// 图书资讯
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RptNews_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((HyperLink)e.Item.FindControl("lnkNews")).Text = LTP.Common.StringClass.GetENString(((CJJCH.Model.T_INF_News)e.Item.DataItem).NewsTitle, 14);
                ((HyperLink)e.Item.FindControl("lnkNews")).ToolTip = ((CJJCH.Model.T_INF_News)e.Item.DataItem).NewsTitle;
                ((HyperLink)e.Item.FindControl("lnkNews")).NavigateUrl = LTP.Common.ConfigHelper.GetConfigString("BookShopWeb") + "NewsDetails.aspx?ID=" + LTP.Common.StringClass.EncodeUrl(((CJJCH.Model.T_INF_News)e.Item.DataItem).ID.ToString()) + "&num=1";
            }
        }
        /// <summary>
        /// 技术标准 政策法规 0
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptStandards1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {

                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkStandards");
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString()=="True")
                {
                    lnkbtn.ForeColor = System.Drawing.Color.Red;
                }
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                lnkbtn.NavigateUrl= "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblStandardsDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }
        /// <summary>
        /// 技术标准 标准信息 1
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptStandards2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkStandards");
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    lnkbtn.ForeColor = System.Drawing.Color.Red;
                }
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(),18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                lnkbtn.NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblStandardsDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }
        /// <summary>
        /// 技术标准  现行标准 2
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptStandards3_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkStandards");
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataName").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataName").ToString();
                lnkbtn.NavigateUrl = "StandardsDetails.aspx?firstid=" 
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())                  
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString())
                    + "&ID=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblStandardsDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }
        
        /// <summary>
        /// 科技推广 评估咨询 3
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptScience2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkScience");
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataSource").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataSource").ToString();
                lnkbtn.NavigateUrl = "~/StandardsDetails.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblScienceDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }

        /// <summary>
        /// 通知公告绑定 4
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptNotice_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((Label)e.Item.FindControl("lblPlusDate")).Text = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    ((HyperLink)e.Item.FindControl("lnkDataTitle")).ForeColor = System.Drawing.Color.Red;
                }
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                DateTime NewsDate = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "BuildDate").ToString()).AddDays(15);
                if (NewsDate > DateTime.Now)
                {
                    ((Image)e.Item.FindControl("ImgNew")).Style.Add("display", "block");
                    ((Image)e.Item.FindControl("ImgNew")).ImageUrl = "~/Image/news.gif";
                }
            }
        }

        /// <summary>
        /// 协会要问绑定 5
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptAssNews_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {

                ((Label)e.Item.FindControl("lblPlusDate")).Text = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    ((HyperLink)e.Item.FindControl("lnkDataTitle")).ForeColor = System.Drawing.Color.Red;
                } 
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                DateTime NewsDate = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "BuildDate").ToString()).AddDays(15);
                if (NewsDate > DateTime.Now)
                {
                    ((Image)e.Item.FindControl("ImgNew")).Style.Add("display", "block");
                    ((Image)e.Item.FindControl("ImgNew")).ImageUrl = "~/Image/news.gif";
                }
            }
        }

        /// <summary>
        /// 政策法规绑定 6
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptPolReg_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {

                ((Label)e.Item.FindControl("lblPlusDate")).Text = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    ((HyperLink)e.Item.FindControl("lnkDataTitle")).ForeColor = System.Drawing.Color.Red;
                } 
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                DateTime NewsDate = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "BuildDate").ToString()).AddDays(15);
                if (NewsDate > DateTime.Now)
                {
                    ((Image)e.Item.FindControl("ImgNew")).Style.Add("display", "block");
                    ((Image)e.Item.FindControl("ImgNew")).ImageUrl = "~/Image/news.gif";
                }
            }
        }

        /// <summary>
        /// 行业要闻绑定 7
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptIndustryNews_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {

                ((Label)e.Item.FindControl("lblPlusDate")).Text = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    ((HyperLink)e.Item.FindControl("lnkDataTitle")).ForeColor = System.Drawing.Color.Red;
                } 
                ((HyperLink)e.Item.FindControl("lnkDataTitle")).NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                DateTime NewsDate = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "BuildDate").ToString()).AddDays(15);
                if (NewsDate > DateTime.Now)
                {
                    ((Image)e.Item.FindControl("ImgNew")).Style.Add("display", "block");
                    ((Image)e.Item.FindControl("ImgNew")).ImageUrl = "~/Image/news.gif";
                }
            }
        }

        /// <summary>
        /// 教育培训 公益讲座 8
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptTeach_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkTeach");
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    lnkbtn.ForeColor = System.Drawing.Color.Red;
                }
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                lnkbtn.NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblTeachDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }

        /// <summary>
        /// 教育培训 专项培训 9
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptTeach2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkTeach");
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    lnkbtn.ForeColor = System.Drawing.Color.Red;
                } 
                lnkbtn.NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblTeachDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }

        /// <summary>
        /// 科技推广 政策法规 10
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptScience1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkScience");
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    lnkbtn.ForeColor = System.Drawing.Color.Red;
                } 
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                lnkbtn.NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblScienceDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }
        
        /// <summary>
        /// 科技推广 检测认证 11
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptScience3_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkScience");
                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                if (DataBinder.Eval(e.Item.DataItem, "IsHot").ToString() == "True")
                {
                    lnkbtn.ForeColor = System.Drawing.Color.Red;
                } 
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                lnkbtn.NavigateUrl = "NewsDetail.aspx?ID="
                    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());
                Label lblDateTime = (Label)e.Item.FindControl("lblScienceDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }

        /// <summary>
        /// 科技推广 成果推广 12
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptScience4_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink lnkbtn = (HyperLink)e.Item.FindControl("lnkScience");

                //lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                //lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();


                lnkbtn.Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "MenuName").ToString(), 18);
                lnkbtn.ToolTip = DataBinder.Eval(e.Item.DataItem, "MenuName").ToString();



                //lnkbtn.NavigateUrl = "NewsDetail.aspx?ID="
                //    + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                //    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                //    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                //    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());

                lnkbtn.NavigateUrl = "ListPage.aspx?curpage=1"
                    //+ LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ID").ToString())
                    + "&firstid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "FirstID").ToString())
                    + "&secondid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "SecondID").ToString())
                    + "&thirdid=" + LTP.Common.StringClass.EncodeUrl(DataBinder.Eval(e.Item.DataItem, "ThirdID").ToString());


                //Label lblDateTime = (Label)e.Item.FindControl("lblScienceDate");
                //lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");
                
                
                //ListPage.aspx?curpage=1&firstid=5&secondid=17&thirdid=0
            }
        }

        /// <summary>
        /// 下载中心  常用资料 13
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptDownload1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((LinkButton)e.Item.FindControl("lbtnDownload")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((LinkButton)e.Item.FindControl("lbtnDownload")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                ((LinkButton)e.Item.FindControl("lbtnDownload")).CommandArgument = DataBinder.Eval(e.Item.DataItem, "DataUrl").ToString() + "," + DataBinder.Eval(e.Item.DataItem, "ID").ToString();
                Label lblDateTime = (Label)e.Item.FindControl("lblDownloaDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }

        protected void lbtnDownload_Click(object sender,EventArgs e)
        {
            string[] str = ((LinkButton)sender).CommandArgument.Replace("~/", "").Replace("\\", "/").Split(',');
            string strPath = Server.MapPath("~/");
            strPath += str[0].ToString();
            bll_download.AddHits(new Guid(str[1].ToString()));
            LTP.Common.FileClass.DownloadFile(strPath);           
        }

        /// <summary>
        ///  下载中心  讲坐讲义 14
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptDownload2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((LinkButton)e.Item.FindControl("lbtnDownload")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((LinkButton)e.Item.FindControl("lbtnDownload")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                ((LinkButton)e.Item.FindControl("lbtnDownload")).CommandArgument = DataBinder.Eval(e.Item.DataItem, "DataUrl").ToString() + "," + DataBinder.Eval(e.Item.DataItem, "ID").ToString();
                Label lblDateTime = (Label)e.Item.FindControl("lblDownloaDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }
        
        /// <summary>
        /// 下载中心  电子刊物 15
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptDownload3_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((LinkButton)e.Item.FindControl("lbtnDownload")).Text = LTP.Common.StringClass.GetENString(DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString(), 18);
                ((LinkButton)e.Item.FindControl("lbtnDownload")).ToolTip = DataBinder.Eval(e.Item.DataItem, "DataTitle").ToString();
                ((LinkButton)e.Item.FindControl("lbtnDownload")).CommandArgument = DataBinder.Eval(e.Item.DataItem, "DataUrl").ToString() + "," + DataBinder.Eval(e.Item.DataItem, "ID").ToString();
                Label lblDateTime = (Label)e.Item.FindControl("lblDownloaDate");
                lblDateTime.Text = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "PlusDate").ToString()).ToString("yyyy/MM/dd");

            }
        }

       
        /// <summary>
        /// 前两个友情链接绑定 21
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptUr1l_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((ImageButton)e.Item.FindControl("ibtnUrl")).ImageUrl = DataBinder.Eval(e.Item.DataItem, "PicUrl").ToString() == "" ? "~/Image/default.jpg" : DataBinder.Eval(e.Item.DataItem, "PicUrl").ToString();
                ((ImageButton)e.Item.FindControl("ibtnUrl")).Attributes.Add("onclick", "window.open('" + DataBinder.Eval(e.Item.DataItem, "URLString").ToString() + "');return false;");
                ((HyperLink)e.Item.FindControl("lnkUrl")).Text = DataBinder.Eval(e.Item.DataItem, "URLName").ToString();
                ((HyperLink)e.Item.FindControl("lnkUrl")).NavigateUrl = DataBinder.Eval(e.Item.DataItem, "URLString").ToString();
            }
        }
        /// <summary>
        /// 后两个友情链接绑定 22
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptUr2l_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((ImageButton)e.Item.FindControl("ibtnUrl")).ImageUrl = DataBinder.Eval(e.Item.DataItem, "PicUrl").ToString() == "" ? "~/Image/default.jpg" : DataBinder.Eval(e.Item.DataItem, "PicUrl").ToString();
                ((ImageButton)e.Item.FindControl("ibtnUrl")).Attributes.Add("onclick", "window.open('" + DataBinder.Eval(e.Item.DataItem, "URLString").ToString() + "');return false;");
                ((HyperLink)e.Item.FindControl("lnkUrl")).Text = DataBinder.Eval(e.Item.DataItem, "URLName").ToString();
                ((HyperLink)e.Item.FindControl("lnkUrl")).NavigateUrl = DataBinder.Eval(e.Item.DataItem, "URLString").ToString();
            }
        }

        /// <summary>
        /// 最后两个友情链接绑定 24
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptUr3l_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ((ImageButton)e.Item.FindControl("ibtnUrl")).ImageUrl = DataBinder.Eval(e.Item.DataItem, "PicUrl").ToString() == "" ? "~/Image/default.jpg" : DataBinder.Eval(e.Item.DataItem, "PicUrl").ToString();
                ((ImageButton)e.Item.FindControl("ibtnUrl")).Attributes.Add("onclick", "window.open('" + DataBinder.Eval(e.Item.DataItem, "URLString").ToString() + "');return false;");
                ((HyperLink)e.Item.FindControl("lnkUrl")).Text = DataBinder.Eval(e.Item.DataItem, "URLName").ToString();
                ((HyperLink)e.Item.FindControl("lnkUrl")).NavigateUrl = DataBinder.Eval(e.Item.DataItem, "URLString").ToString();
            }
        }

        protected void btnOnLine_Click(object sender, EventArgs e)
        {

        }

        protected void img_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("ExpertAppraisal.aspx?firstid=4&secondid=12&thirdid=0");
        }

        protected void ImgProgress_Click(object sender, ImageClickEventArgs e)
        {
            //Response.Redirect("ExpertAppraisal.aspx?firstid=4&secondid=12&thirdid=0");
            LTP.Common.WindowClass.WindowGoHref("ExpertAppraisal.aspx?firstid=4&secondid=12&thirdid=0");
        }

        protected void imgBookNews_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect(LTP.Common.ConfigHelper.GetConfigString("BookShopWeb")+"NewsLists.aspx?num=1");
        }
    }
}